package com.xiaolin.modules.course.controller;

import com.xiaolin.common.utils.R;
import com.xiaolin.feign.CourseFeign;
import com.xiaolin.modules.course.entity.CourseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;

/**
 * @ClassName CourseController
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/10/18
 * @Version 1.0
 */
@RestController
@RequestMapping("course/course")
public class CourseController {
    @Autowired
    CourseFeign courseFeign;

    @GetMapping("/list")
    public R list(@RequestParam Map<String,Object> params){
        R list = courseFeign.list(params);
        return list;
    }

    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        return courseFeign.info(id);
    }

    @RequestMapping("/save")
    public R save(@RequestBody CourseEntity course){
        return courseFeign.save(course);
    }

    @RequestMapping("/update")
    public R update(@RequestBody CourseEntity course){
        return courseFeign.update(course);
    }

    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        return courseFeign.delete(ids);
    }
}
